package app.kernel.psgManager;

public class PSG_Manager {

	public static PSG_Registry myRegistry = new PSG_Registry();
	
	// Return a list of neighoring peers.
	public String register_PSG(String SCName, String IPAddress, int Port){
		
		String result;
		//result = new String[10];		
		PhysicalSpace PS = new PhysicalSpace(SCName, "http://"+IPAddress+":"+Port+"/xmlrpc");
		System.out.println("PSG_MANAGER: Register PS: ");
		String[] resultArray = myRegistry.getListOfPSG();
		
		String linearResult="";
		for (int i=0; i<resultArray.length; i++){
			
			System.out.println(resultArray[i]);
			if (resultArray[i]!=null)
			   linearResult+=resultArray[i]+";";
			
		}
		System.out.println("PSG_MANAGER: Register PS: ");
		myRegistry.addPSG(PS);
		System.out.println("PSG_MANAGER: Register PS: ");
		return linearResult;
		
	}
	
	// Return entry point for quering the Semantic Clusters
	public String queryMCS(String queryString){
		
		return myRegistry.getRandomPeerReference();
		
	}
	
	
}
